<template>
    <a-card :bordered="false">
        <company-list ref="companylist" v-if="mode == 1" @changeMode="changeMode"></company-list>
        <company-detail ref="companyDetail" v-if="mode == 2" @changeMode="changeMode"
            :companyInfo="companyInfo"></company-detail>
        <store-list ref="storeList" v-if="mode == 3" @changeMode="changeMode"></store-list>
    </a-card>
</template>
  
<script>

import '@/assets/less/TableExpand.less'
import companyList from './modules/companyList.vue'
import companyDetail from './modules/companyDetail.vue'
import storeList from './modules/storeList.vue'

export default {
    name: 'HcRiderList',
    components: { companyList, companyDetail, storeList },
    data() {
        return {
            mode: '1', //展示内容代号，1：企业列表，2：企业商户列表详情，3：菜品编辑
            companyInfo: ''
        }
    },
    created() {
    },
    mounted() {
    },
    computed: {
    },
    methods: {
        changeMode(mode, record) {
            // console.log('record', record);
            // console.log('companyId', record.id, 'companyName', record.companyName)
            this.mode = mode;
            if (this.mode == 2) {
                if (record) { this.companyInfo = record; }
                this.$nextTick(() => {
                    this.$refs.companyDetail.show(this.companyInfo.id);
                });
            } else if (this.mode == 3) {
                this.$nextTick(() => {
                    this.$refs.storeList.show(record);
                });
            }
        }
    }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>